<?php

namespace Admin\Controller;
use Think\Controller;



class LoginController extends Controller{

	public function login(){
		$this->display();
	}

	public function doLogin(){
		$condition = array(
			'adminname'=>$_POST['adminname'],
			//'pass'=>md5(I('post.password'))
			'pass'=>I('post.password')
		);

		$adminModel = M('Admins');
		$admin = $adminModel->where($condition)->find();
		if($admin){
			session('admin',$admin);
			$this->redirect('Index/users');
		}else{
			$this->error('用户名或口令错误');
		}
	}

	public function logout(){
		session('admin',null);
		$this->redirect('Login/login');
	}

}





?>